<template>
  <div>
    <a-card :bordered="false">
      <f-search-form :more="false" @searchHandler="searchHandler">
        <f-search-form-item label="采购订单号" name="purchaseorderNo"/>
        <f-search-form-item label="订单类型" name="purchaseorderType"/>
        <f-search-form-item label="采购订单号" name="erppurchaseOrderno"/>
        <f-search-form-item label="订单日期" name="purchaseorderTime"/>
        <f-search-form-item label="采购组织名称" name="purchasingOrgName"/>
        <f-search-form-item label="供应商编码" name="vendorCode"/>
        <f-search-form-item label="供应商名称" name="vendorName"/>
        <f-search-form-item label="公司名称" name="companyCode"/>
        <f-search-form-item label="公司编码" name="companyName"/>
      </f-search-form>
      <f-table ref="table" rowKey="purchaseorderId" :columns="columns" :exportBtn="true" :multiple="true" :operator="operator" :params="queryParam" :api="api.purchaseorder">
        <span slot="action" slot-scope="text, record">
          <template>
            <a @click="$refs.drawer.showDrawer(record)">编辑</a>
            <a-divider type="vertical"/>
          </template>
          <a-dropdown>
            <a class="ant-dropdown-link">更多 <a-icon type="down"/></a>
            <a-menu slot="overlay">
              <a-menu-item v-if="$auth('table.delete')">
                <a href="javascript:;" @click="$refs.table.del(record)">删除</a>
              </a-menu-item>
            </a-menu>
          </a-dropdown>
        </span>
      </f-table>
      <purchaseorder-drawer ref="drawer"></purchaseorder-drawer>
    </a-card>
  </div>
</template>
<script>
  import purchaseorderDrawer from './purchaseorder_drawer.vue'
  import api from './js/api'
  export default {
    name: 'TableList',
    components: {
      purchaseorderDrawer
    },
    data() {
      let me = this
      //操作按钮
      let operator = []
      operator.push({
        name: '添加',
        icon: 'plus',
        that: this,
        handler: function(table, that) {
            that.$refs.drawer.showDrawer()
        }
      })
      operator.push({
        name: '删除',
        icon: 'delete',
        batch: true,
        handler: function(table) {
            table.remove()
        }
      })
      return {
        api:  Object.assign(api, this.api),
        //列表初始化查询参数
        queryParam: {},
        // 表头
        columns: [
          {
            title: '采购订单号',
            align: 'center',
            dataIndex: 'purchaseorderNo'
          },
          {
            title: '订单类型',
            align: 'center',
            dataIndex: 'purchaseorderType'
          },
          {
            title: '采购订单号',
            align: 'center',
            dataIndex: 'erppurchaseOrderno'
          },
          {
            title: '订单日期',
            align: 'center',
            dataIndex: 'purchaseorderTime'
          },
          {
            title: '采购组织名称',
            align: 'center',
            dataIndex: 'purchasingOrgName'
          },
          {
            title: '供应商编码',
            align: 'center',
            dataIndex: 'vendorCode'
          },
          {
            title: '供应商名称',
            align: 'center',
            dataIndex: 'vendorName'
          },
          {
            title: '公司名称',
            align: 'center',
            dataIndex: 'companyCode'
          },
          {
            title: '公司编码',
            align: 'center',
            dataIndex: 'companyName'
          },
          {
            title: '货币编码',
            align: 'center',
            dataIndex: 'currencyCode'
          },
          {
            title: '货币名称',
            align: 'center',
            dataIndex: 'currencyName'
          },
          {
            title: '货币汇率',
            align: 'center',
            dataIndex: 'currencyRate'
          },
          {
            title: '订单金额',
            align: 'center',
            dataIndex: 'totalAmount'
          },
          {
            title: '附件ID',
            align: 'center',
            dataIndex: 'uploadfileGroupId'
          },
          {
            title: '订单状态',
            align: 'center',
            dataIndex: 'purchaseorderState'
          },
          {
            title: '审核状态',
            align: 'center',
            dataIndex: 'purchaseorderFlowState'
          },
          {
            title: '确认状态',
            align: 'center',
            dataIndex: 'purchaseorderCheckState'
          },
          {
            title: 'ERP同步标识,0未同步,1已同步',
            align: 'center',
            dataIndex: 'erpSynState'
          },
          {
            title: '创建方式',
            align: 'center',
            dataIndex: 'createType'
          },
          {
            title: '供应商查看标识',
            align: 'center',
            dataIndex: 'viewFlag'
          },
          {
            title: 'ERP返回信息',
            align: 'center',
            dataIndex: 'erpReturnMsg'
          },
          {
            title: '先确认后审核标识1是先确认，0是先审核',
            align: 'center',
            dataIndex: 'checkFirst'
          },
          {
            title: '',
            align: 'center',
            dataIndex: 'isViewPriceFlag'
          },
          {
            title: '客户端编码',
            align: 'center',
            dataIndex: 'clientCode'
          },
          {
            title: '备注',
            align: 'center',
            dataIndex: 'remark'
          },
          {
            title: '创建人ID',
            align: 'center',
            dataIndex: 'createId'
          },
          {
            title: '创建人姓名',
            align: 'center',
            dataIndex: 'createName'
          },
          {
            title: '创建时间',
            align: 'center',
            dataIndex: 'createTime'
          },
          {
            title: '修改人ID',
            align: 'center',
            dataIndex: 'modifyId'
          },
          {
            title: '修改人姓名',
            align: 'center',
            dataIndex: 'modifyName'
          },
          {
            title: '修改时间',
            align: 'center',
            dataIndex: 'modifyTime'
          },
          {
            title: '采购组编码',
            align: 'center',
            dataIndex: 'purchasingGroupCode'
          },
          {
            title: '采购组姓名',
            align: 'center',
            dataIndex: 'purchasingGroupName'
          },
          {
            title: '供应商编码',
            align: 'center',
            dataIndex: 'vendorerpCode'
          },
          {
            title: '供应商未查看flg',
            align: 'center',
            dataIndex: 'isvendorView'
          },
          {
            title: '已收货量',
            align: 'center',
            dataIndex: 'receiveQty'
          },
          {
            title: '可送数量',
            align: 'center',
            dataIndex: 'cansendQty'
          },
          {
            title: '是否撤销审批',
            align: 'center',
            dataIndex: 'isrevocationCheck'
          },
          {
            title: '采购组织编码',
            align: 'center',
            dataIndex: 'purchasingorgCode'
          },
          {
            title: '供应商接受操作结果',
            align: 'center',
            dataIndex: 'returnValue'
          },
          {
            title: '供应商确认时间',
            align: 'center',
            dataIndex: 'vendorconfirmTime'
          },
          {
            title: '',
            align: 'center',
            dataIndex: 'internationlRradeterm'
          },
          {
            title: '',
            align: 'center',
            dataIndex: 'internationlRradeRemark'
          },
          {
            title: '税率编码',
            align: 'center',
            dataIndex: 'taxrateCode'
          },
          {
            title: '',
            align: 'center',
            dataIndex: 'orderReleaseTime'
          },
          {
            title: '是否紧急',
            align: 'center',
            dataIndex: 'urgent'
          },
          {
            title: '合同编码',
            align: 'center',
            dataIndex: 'contractNo'
          },
          {
            title: '合同名称',
            align: 'center',
            dataIndex: 'contractName'
          },
          {
            title: '项目名称',
            align: 'center',
            dataIndex: 'projectNo'
          },
          {
            title: '项目编码',
            align: 'center',
            dataIndex: 'projectName'
          },
          {
            title: '工程包号',
            align: 'center',
            dataIndex: 'engineeringNo'
          },
          {
            title: '联系人',
            align: 'center',
            dataIndex: 'contacts'
          },
          {
            title: '联系人电话',
            align: 'center',
            dataIndex: 'contactPhone'
          },
          {
            title: '税率',
            align: 'center',
            dataIndex: 'taxrateValue'
          },
          {
            title: '交货地点',
            align: 'center',
            dataIndex: 'deliveryPlace'
          },
          {
            title: '代购商id',
            align: 'center',
            dataIndex: 'vendoragentId'
          },
          {
            title: '代购商编码',
            align: 'center',
            dataIndex: 'vendoragentCode'
          },
          {
            title: '代购商姓名',
            align: 'center',
            dataIndex: 'vendoragentName'
          },
          {
            title: '项目材料员',
            align: 'center',
            dataIndex: 'projectStuffer'
          },
          {
            title: '项目材料员邮箱',
            align: 'center',
            dataIndex: 'projectStufferMail'
          },
          {
            title: '项目材料员电话',
            align: 'center',
            dataIndex: 'projectStufferPhone'
          },
          {
            title: '指定收货人名',
            align: 'center',
            dataIndex: 'receiver'
          },
          {
            title: '指定收货人邮箱',
            align: 'center',
            dataIndex: 'receiverMail'
          },
          {
            title: '指定收货人电话',
            align: 'center',
            dataIndex: 'receiverPhone'
          },
          {
            title: '预算总金额',
            align: 'center',
            dataIndex: 'budgetAmount'
          },
          {
            title: '承诺占用金额',
            align: 'center',
            dataIndex: 'promiseAmount'
          },
          {
            title: '实际成本金额',
            align: 'center',
            dataIndex: 'actualAmount'
          },
          {
            title: '累计变更未税金额',
            align: 'center',
            dataIndex: 'changeAmount'
          },
          {
            title: '合同总金额',
            align: 'center',
            dataIndex: 'contractAmount'
          },
          {
            title: '运费、包装费及其他杂费',
            align: 'center',
            dataIndex: 'otherCharge'
          },
          {
            title: '折扣总金额',
            align: 'center',
            dataIndex: 'discountAmount'
          },
          {
            title: '付款条件编码',
            align: 'center',
            dataIndex: 'paymenttypeCode'
          },
          {
            title: '付款条件',
            align: 'center',
            dataIndex: 'paymenttypeName'
          },
          {
            title: '需求申请人编码',
            align: 'center',
            dataIndex: 'proposerCode'
          },
          {
            title: '需求申请人',
            align: 'center',
            dataIndex: 'proposer'
          },
          {
            title: '订购比例',
            align: 'center',
            dataIndex: 'subScriptionRatio'
          },
          {
            title: '工作范围',
            align: 'center',
            dataIndex: 'workingScope'
          },
          {
            title: '施工周期',
            align: 'center',
            dataIndex: 'constructionPeriod'
          },
          {
            title: '指定收货人编码',
            align: 'center',
            dataIndex: 'receiverCode'
          },
          {
            title: '项目材料员编码',
            align: 'center',
            dataIndex: 'projectStufferCode'
          },
          {
            title: '采购员',
            align: 'center',
            dataIndex: 'purchaseuserName'
          },
          {
            title: '采购员id',
            align: 'center',
            dataIndex: 'purchaseuserId'
          },
          {
            title: '是否有合同编码标识',
            align: 'center',
            dataIndex: 'contractNoflag'
          },
          {
            title: '已有订购金额',
            align: 'center',
            dataIndex: 'subScription'
          },
          {
            title: '累计变更未税金额',
            align: 'center',
            dataIndex: 'changeNotaxAmount'
          },
          {
            title: '合同总金额',
            align: 'center',
            dataIndex: 'contractallNotaxAmount'
          },
          {
            title: '订单未税金额',
            align: 'center',
            dataIndex: 'orderNotaxAmount'
          },
          {
            title: '模板权限ID组',
            align: 'center',
            dataIndex: 'auditorIds'
          },
          {
            title: '专业分类',
            align: 'center',
            dataIndex: 'materialKindCode'
          },
          {
            title: '更新时间',
            align: 'center',
            dataIndex: 'updateTime'
          },
          {
            title: '操作',
            align: 'center',
            scopedSlots: { customRender: 'action' }
          }
        ],
        operator: operator
      }
    },
    created() {
    },
    methods: {
    }
  }
</script>
